package com.cw.DesignModel23.Behavioral.MediatorPattern.Mediator2;

public class CoffeeMachine extends Colleague {

    /**
     * 构造器
     * @param mediator
     * @param name
     */
    public CoffeeMachine(Mediator mediator, String name) {
        super(mediator, name);
        //在创建Alarm 同事对象时，将自己放入到ConcreteMediator 对象的集合中
        mediator.register(name, this);
    }

    public void FinishCoffee() {
        SendMessage(5);
    }

    public void StartCoffee() {
    }

    @Override
    public void SendMessage(int stateChange) {
        //调用的中介者对象的getMessage
        this.GetMediator().getMessage(stateChange, this.name);
    }

}
